package com.hjm.project.TransactionAccumulation.transactionAccumulationD.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.hjm.framework.aspectj.lang.annotation.Log;
import com.hjm.framework.aspectj.lang.enums.BusinessType;
import com.hjm.project.TransactionAccumulation.transactionAccumulationD.domain.TransactionAccumulationD;
import com.hjm.project.TransactionAccumulation.transactionAccumulationD.service.ITransactionAccumulationDService;
import com.hjm.framework.web.controller.BaseController;
import com.hjm.framework.web.domain.AjaxResult;
import com.hjm.common.utils.poi.ExcelUtil;
import com.hjm.framework.web.page.TableDataInfo;

import javax.annotation.Resource;

/**
 * 增量累计明细Controller
 * 
 * @author maker-platform
 * @date 2021-07-07
 */
@Controller
@RequestMapping("/TransactionAccumulationD/transactionAccumulationD")
public class TransactionAccumulationDController extends BaseController
{
    private String prefix = "transactionAccumulation/tad";

    @Resource
    private ITransactionAccumulationDService transactionAccumulationDService;

    @RequiresPermissions("TransactionAccumulationD:transactionAccumulationD:view")
    @GetMapping()
    public String transactionAccumulationD()
    {
        return prefix + "/tad";
    }

    /**
     * 查询增量累计明细列表
     */
    @RequiresPermissions("TransactionAccumulationD:transactionAccumulationD:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(TransactionAccumulationD transactionAccumulationD)
    {
        startPage();
        List<TransactionAccumulationD> list = transactionAccumulationDService.selectTransactionAccumulationDList(transactionAccumulationD);
        return getDataTable(list);
    }

    /**
     * 导出增量累计明细列表
     */
    @RequiresPermissions("TransactionAccumulationD:transactionAccumulationD:export")
    @Log(title = "增量累计明细", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(TransactionAccumulationD transactionAccumulationD)
    {
        List<TransactionAccumulationD> list = transactionAccumulationDService.selectTransactionAccumulationDList(transactionAccumulationD);
        ExcelUtil<TransactionAccumulationD> util = new ExcelUtil<TransactionAccumulationD>(TransactionAccumulationD.class);
        return util.exportExcel(list, "transactionAccumulationD");
    }

    /**
     * 新增增量累计明细
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存增量累计明细
     */
    @RequiresPermissions("TransactionAccumulationD:transactionAccumulationD:add")
    @Log(title = "增量累计明细", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(TransactionAccumulationD transactionAccumulationD)
    {
        return toAjax(transactionAccumulationDService.insertTransactionAccumulationD(transactionAccumulationD));
    }

    /**
     * 修改增量累计明细
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Integer id, ModelMap mmap)
    {
        TransactionAccumulationD transactionAccumulationD = transactionAccumulationDService.selectTransactionAccumulationDById(id);
        mmap.put("transactionAccumulationD", transactionAccumulationD);
        return prefix + "/edit";
    }

    /**
     * 修改保存增量累计明细
     */
    @RequiresPermissions("TransactionAccumulationD:transactionAccumulationD:edit")
    @Log(title = "增量累计明细", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(TransactionAccumulationD transactionAccumulationD)
    {
        return toAjax(transactionAccumulationDService.updateTransactionAccumulationD(transactionAccumulationD));
    }

    /**
     * 删除增量累计明细
     */
    @RequiresPermissions("TransactionAccumulationD:transactionAccumulationD:remove")
    @Log(title = "增量累计明细", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(transactionAccumulationDService.deleteTransactionAccumulationDByIds(ids));
    }
}
